<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let p1 = new Person('小名', 10);
        console.log(p1);
        class Person {
            constructor(name, age) { // 构造函数，调用new 自动执行
                this.name = name;
                this.age = age
            }
        };
    </script>
</body>

</html>